import 'package:flutter/material.dart';

/// @date 2020/08/06  17:58
/// @author 程志强
/// @des 图片动画组件

class AnimationImage extends AnimatedWidget {
  final String imgPath;

  AnimationImage({this.imgPath, Animation<double> animation})
      : super(listenable: animation);

  @override
  Widget build(BuildContext context) {
    final Animation<double> _animation = listenable;
    return Center(
      child: Image.network(imgPath,
          width: _animation.value, height: _animation.value),
    );
  }
}

class GrowTransition extends StatelessWidget {
  final Widget child;
  final Animation<double> animation;

  GrowTransition({this.child, this.animation});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: AnimatedBuilder(
        animation: animation,
        builder: (BuildContext context, Widget child) {
          return Container(
            height: animation.value,
            width: animation.value,
            child: child,
          );
        },
        child: child,
      ),
    );
  }
}
